var slick = document.querySelector('.slick-track');
var slide = document.querySelectorAll('.slick-track>.slick-slide')
slick.appendChild(slick.firstElementChild.cloneNode(true));
slick.style.width=slide.length*slide[0].offsetWidth+408+'px';
var kl = 0;
function kode (){
    kl++
    if(kl==4){
        slick.style.transition='0s'
        slick.style.marginLeft='0px'
        kl=0;
        setTimeout("slick.style.transition='1s'",100)
        setTimeout("kode()",100)
        }else{
            slick.style.marginLeft=-kl*408+"px"
        }
    }
setInterval('kode()',2000)


var coping = document.getElementsByClassName('nav-body');
var icon = document.getElementsByClassName('right-box');
var res;
//遍历
    //给每个li绑定一个属性  属性值是i
    icon[0].a=0;
    //给每一个li绑定一个点击事件
    icon[0].onclick=function(){
        //调用运动函数
        res = running(coping[this.a].offsetTop);
    }
var xh=null;
function running(num){ //目标值   500    0
    clearInterval(xh);
    xh=setInterval(function(){
        var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
        //目标值与当前值之间的距离    
        var jl=(num-scrollTop)/10;
        jl=jl>0?Math.ceil(jl):Math.floor(jl);//本次执行需要移动的距离
        document.body.scrollTop=scrollTop+jl;
        if(document.body.scrollTop) {
                document.body.scrollTop=scrollTop+jl;
            } else {
                document.documentElement.scrollTop=scrollTop+jl;
        }
        //判断当前文档滚动高度是否与目标一致
        if(num==scrollTop){
            //停止循环
            clearInterval(xh);
        }
    },1000/100);
    return num;
}